import { request } from './client.js';

async function getPodLogs(options) {
  const { bearerToken, podId } = options;
  return request(`/pod/${podId}/logs`, {
    headers: {
      Authorization: `Bearer ${bearerToken}`
    }
  });
}
async function getPodStatus(options) {
  const { bearerToken, podId } = options;
  return request(`/pod/${podId}/status`, {
    headers: {
      Authorization: `Bearer ${bearerToken}`
    }
  });
}
async function getRoboStatus(options) {
  const { bearerToken, roboId } = options;
  return request(`/robo/${roboId}/status`, {
    backoff: false,
    headers: {
      Authorization: bearerToken ? `Bearer ${bearerToken}` : void 0
    },
    silent: true
  });
}
async function listPods(options) {
  const { bearerToken, userId } = options;
  return request(`/user/${userId}/pods`, {
    headers: {
      Authorization: `Bearer ${bearerToken}`
    }
  });
}
async function listRobos(options) {
  const { bearerToken, userId } = options;
  return request(`/user/${userId}/robos`, {
    headers: {
      Authorization: `Bearer ${bearerToken}`
    }
  });
}
async function startPod(options) {
  const { bearerToken, podId } = options;
  return request(`/pod/${podId}/start`, {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${bearerToken}`
    }
  });
}
async function stopPod(options) {
  const { bearerToken, podId } = options;
  return request(`/pod/${podId}/stop`, {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${bearerToken}`
    }
  });
}

export { getPodLogs, getPodStatus, getRoboStatus, listPods, listRobos, startPod, stopPod };
